package collectionhomework;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo1 {
    public static void main(String[] args) {
        Collection c=new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
       c.add("four");
       c.add("five");
       boolean b =c.add("one");//HashSet，此处为false，set集合不可重复
        System.out.println(b);
        System.out.println(c);
        System.out.println("size="+c.size());//输出集合的元素个数
        System.out.println("是否是空集："+c.isEmpty());
        c.clear();//清空集合
        System.out.println("集合已清空");
        System.out.println(c);
        System.out.println("size="+c.size());
        System.out.println("是否是空集："+c.isEmpty());
    }
}
